package com.bosssoft.goods.domain.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;

/**
 * 更改商品信息数据对象
 * @author Fang_Sir
 * @date 2021-04-22
 */
@Getter
@Setter
public class EditGoodInfoVO {
    @ApiModelProperty("商品编号")
    @NotNull(message = "商品编号不得为空")
    private Long gid;

    @ApiModelProperty("商品名称")
    @NotNull(message = "商品名称不得为空")
    private String name;

    @ApiModelProperty("商品库存")
    @NotNull(message = "商品库存不得为空")
    private Integer stock;

    @ApiModelProperty("商品上架状态")
    @NotNull(message = "上架状态不得为空")
    private Boolean onSale;

    @ApiModelProperty("商品描述")
    private String content;

    public int getSaleValue() {
        return onSale ? 1 : 0;
    }
}
